/*
 * CPoisonDeadly.java
 *
 * Copyright (c) 2009 Giles Millward (Manigra). All rights reserved.
 *
 * This file is part of JRogueDPS.
 *
 * JRogueDPS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JRogueDPS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with JRogueDPS.  If not, see <http://www.gnu.org/licenses/>.
 */

package dpssystem;

import dpsstats.CDamageStats;
import dpssystem.CAttackChance.HitType;

/**
 *
 * @author Mani
 */
public class CPoisonDeadly extends CPoison {

    public double m_averageDamage = 296.0; // Deadly Poison IX
    public double m_hitChance = 0.30;
    public double m_vilePoisonBoost;

    CPoisonDeadly(CWeapon p_weapon, CDamageStats p_damageStats, CSim p_sim)
    {
        super("Deadly Poison", PoisonType.DEADLY, p_weapon, p_damageStats, p_sim);
        m_hitChance += (p_sim.m_dpsInterface.m_talents.getImprovedPoisonsDouble() * 2);
    }

    public void procPoison(boolean p_shiv)
    {
        // TODO hit chance will need altering if master poisoner specced
        double l_hitChance = m_hitChance;
        if (m_sim.m_envenom.hasEnvenomBuff())
        {
            // Add 15% extra chance
            l_hitChance += 0.15;
        }

        if (p_shiv || this.m_sim.m_rng.nextDouble() <= l_hitChance)
        {
            HitType l_hitType = this.m_sim.m_attackChance.getSpellHit(
                    this.m_sim.m_baseStats.getSpellHitChance());
            if (l_hitType == HitType.MISS)
            {
                this.m_damageStats.addStats(l_hitType, 0.0);
                return;
            }

            CEvent l_dotEvent = this.m_sim.m_target.m_deadlyPoisonDOT.refreshDOT(m_sim);
            if (l_dotEvent != null) {
                m_sim.m_eventList.add(l_dotEvent);
            }

            this.m_damageStats.addStats(HitType.NORMAL, 0.0);
        }
        else
        {
            this.m_damageStats.addStats(HitType.MISS, 0.0);
        }
    }


}
